<template>
  <div class="card">
    <div class="top">
      <img :src="item.cover" alt="" />
    </div>
    <div class="bottom">
      <div class="title"><router-link :to="'/article/'+item.id">{{item.title}}</router-link></div>
      <div class="span" v-if="item.top ==100">
            <i class="iconfont icon-zhiding"></i>置顶
        </div>
      <div class="introduction">
        {{item.about}}
      </div>
      <div class="time"><i class="el-icon-date"></i> {{timeago.format(item.createTime,'zh_CN')}}</div>
    </div>
  </div>
</template>

<script>
import * as timeago from "timeago.js";
export default {
props:['item'],data(){
    return {
        timeago
    }
}
}
</script>

<style lang="scss" scoped>
.card {
  width: 100%;
  min-height: 50vh;
  background-color: #fff;
  margin-bottom: 10px;
  border-radius: 10px;
  box-shadow: var(--box-shadow);
  .top {
    height: 30vh;
    overflow: hidden;
    img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      object-position: center;
      border-radius: 10px 10px 0 0;
    }
  }
  .bottom {
    padding: 2vh 1vh;
    .title {
      font-size: 20px;
      padding: 5px;
      margin-bottom: 1vh;
      a{
        display: block;
        color:var(--font-color);
        font-size: 1em;
      }
    }
    .span{
            color: #f9ac06;
            i{
                font-size: 16px;
            }
        }
    .time {
      margin-top: 10px;
    }
  }
}
</style>